/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package exercises.day04.pt01.dao;

import exercises.day04.pt01.bean.Account_Holder_Transaction;
import java.sql.PreparedStatement;
import java.sql.SQLException;

/**
 *
 * @author Student
 */
public class Account_Holder_Transaction_DAO extends Connector {

    public Account_Holder_Transaction_DAO() {
    }
    
    public boolean log(Account_Holder_Transaction aht)
    {
          try {
            //INSERT INTO ROOT.REGISTRATION (CFIRST_NAME, CLAST_NAME, CADDRESS, CACCOUNT_TYPE, MANNUAL_INCOME, CPHONE_NO) VALUES (5, 'Laurry', 'Helbert', 'Rock St.Seattle 234657', 'Fixed Deposit                 ', 450000.0, '0416348');

            PreparedStatement ps = this.getConn().prepareStatement("INSERT INTO ROOT.ACCOUNT_HOLDER_TRANSACTION "
                    + "( CACCOUNT_ID, DDATE_OF_TRANSACTION, VCPARTICULARS, CCHECK_NO,"
                    + " MAMOUNT) VALUES (?,?,?,?,?)");
  
            ps.setString(1, aht.getAccountID());
            ps.setDate(2, aht.getDateOfTransaction());
            ps.setString(3, aht.getParticulars());
            ps.setString(4, aht.getCheckNo());
            ps.setDouble(5, aht.getAmount());
            
            
  
            ps.executeUpdate();

        } catch (SQLException ex) {
            System.out.println(ex.toString());

            return false;
        }

        return true;
    }
    
    
}
